from rest_framework import serializers
from goods.models import SKUImage, SKU


class SKUImageSerializer(serializers.ModelSerializer):
    """SKUImage 表序列化器"""
    sku = serializers.PrimaryKeyRelatedField(read_only=True)
    # sku_id = serializers.IntegerField()

    class Meta:
        model = SKUImage
        fields = "__all__"


class SKUSerializer(serializers.ModelSerializer):
    """SKU表序列化器"""

    class Meta:
        model = SKU
        fields = ('id', 'name')
